<?php
/*********************************************
  CPG Dragonfly™ CMS
  ********************************************
  Copyright © 2004 - 2007 by CPG-Nuke Dev Team
  http://dragonflycms.org

  Dragonfly is released under the terms and conditions
  of the GNU GPL version 2 or any later version
**********************************************/
if (!defined('ADMIN_PAGES')) { exit; }
if (!can_admin('referers')) { die('Access Denied'); }

$db = Dragonfly::getKernel()->SQL;

if (isset($_GET['del']) && $_GET['del'] == 'all')
{
	$db->query("DELETE FROM {$db->TBL->referer}");
	URL::redirect(URL::admin());
}

else
{
	Dragonfly_Page::setTitle(_HTTPREFERERS);

	$result = $db->query("SELECT url FROM {$db->TBL->referer}");
	if ($result->num_rows)
	{
		$TPL = Dragonfly::getKernel()->OUT;
		$TPL->referers = $result;
		$TPL->display('admin/referers');
	}
	else
	{
		require_once('header.php');
		OpenTable();
		echo sprintf(_ERROR_NONE_TO_DISPLAY, strtolower(_HTTPREFERERS));
		CloseTable();
	}
}
